Thread: [Console UI library] A small problem in completing dialoge box

  1. #1
    Registered User Al3's Avatar
    Join Date
    Nov 2014
    Posts
    135

    [Console UI library] A small problem in completing dialoge box

    Hello developers!
    I am very new to the community so let me first add-up some things about me.
    I am currently 17 years old, C programmer, currently living in Bulgaria. (Born in Bulgaria as well) I seriously enjoy C-programming, currently taking courses for professional license - diploma "Programmer" and I already passed the C test. Recently we are learning "Application Programming on C with GTK+" But I already have some experience with that.. all fight for the diploma..
    I intend to be useful to the community as much as possible

    Back on topic. I am coding Fake GUI / UI library for Windows consoles. Ncurses might be good, but a bit advanced and not entirely oriented to UI. My library will have fully-functional dialog boxes, text boxes, buttons including dragging feature for you to drag boxes around. So far I have a dialog box working. I am not going to get into details, you will compile it by yourself and see how is it working

    Direct download the progress of the library.

    The problem in it is when you input shorter string as a box fill. I don't have a good idea of how to fill the rest of the box with the background color of the box.

    Filled of text:
    [Console UI library] A small problem in completing dialoge box-cool-af-png

    (The problem) Non-filled of text:
    [Console UI library] A small problem in completing dialoge box-cool-af2-png

    Or just blank box:
    [Console UI library] A small problem in completing dialoge box-cool-af3-png
    Last edited by Al3; 11-17-2014 at 05:37 AM.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Could you just add spaces to the dialog text so that it fills out the rest of the box? The background color for the "space" character should be the same as the other text.

    gg

  3. #3
    Registered User Al3's Avatar
    Join Date
    Nov 2014
    Posts
    135
    How do you think the latest picture is outputted ?
    It just doesn't fit well with the text-filling..

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    I'm not currently in a position where I can download your code, so the best I can do is offer a suggestion and hope it'll be useful for you.

    1. Create an array large enough to hold all characters in the dialog box
    2. Before use, "clear" this array by filling it with spaces
    3. Create a function that receives your string of interest, and updates the array with those characters
    4. Use this array to fill in your dialog box

    This way, any "unused" slots in your array will be spaces by default.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    You should employ the same methods as is common for the various states.

    Test < Space): You fill the empty space with a fill character. (You should allow the client code to specify the character with the interface.)

    Text == Space): You do nothing special.

    Text > Space): You print a "more" marker such as the '>' character or similar. (You should allow the client code to specify the character with the interface.)

    If you are really trying to make a robust GUI, you should just optionally print a scrollbar allowing the dialog window with too much text to be viewed.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  6. #6
    Registered User Al3's Avatar
    Join Date
    Nov 2014
    Posts
    135
    Well okay, but unless you can download the code (which is a direct page) you can't give me ideas of reconstruction. I am not going to reconstruct the entire function. As a programmer, I like it that way and I am searching for a way that will fit it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. looking for small freeware library that support http connections
    By umen242 in forum Networking/Device Communication
    Replies: 0
    Last Post: 03-23-2008, 03:21 AM
  2. Console Library Update
    By cfrost in forum C++ Programming
    Replies: 0
    Last Post: 12-08-2004, 10:44 PM
  3. My Console Library For Dev C++
    By cfrost in forum C++ Programming
    Replies: 21
    Last Post: 11-09-2004, 07:22 AM
  4. CPaintDC in dialoge
    By cfrost in forum Windows Programming
    Replies: 3
    Last Post: 07-24-2004, 11:01 AM
  5. A small problem with a small program
    By Wetling in forum C Programming
    Replies: 7
    Last Post: 03-25-2002, 09:45 PM

Tags for this Thread